home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 10.2 KB | 300 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWFileOp.h
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWFILEOP_H
- #define FWFILEOP_H
-
- #ifndef SLFILEOP_H
- #include "SLFileOp.h"
- #endif
-
- //========================================================================================
- // CLASS FW_COpenFileParameters - parameters for StandardGetFile (Mac) and GetOpenFileName (Windows)
- //========================================================================================
-
- class FW_COpenFileParameters
- {
- public:
- FW_DECLARE_AUTO(FW_COpenFileParameters)
-
- FW_COpenFileParameters();
- ~FW_COpenFileParameters();
-
- #ifdef FW_BUILD_MAC
- FW_COpenFileParameters(OSType fileType, FileFilterProcPtr fileFilterProc = NULL);
- // Use when there's only one file type
-
- FW_COpenFileParameters(short numTypes,
- OSType* fileTypeArray,
- FileFilterProcPtr fileFilterProcc = NULL);
- // Use for more than 2 file types
-
- FW_COpenFileParameters(FileFilterProcPtr fileFilterProc);
- // Use for filter proc only
-
- void Set(short numTypes,
- OSType* fileTypeArray,
- FileFilterProcPtr fileFilterProc);
-
- short MacCountTypes() const;
- FileFilterProcPtr MacGetFilterProc() const;
- OSType* MacGetTypes() const;
- #endif
-
- #ifdef FW_BUILD_WIN
- FW_COpenFileParameters(const FW_CString& filterString,
- const FW_CString& defaultExt,
- HWND ownerWindow = NULL);
-
- void Set(const FW_CString& filterString,
- const FW_CString& defaultExt);
-
- char* WinGetFilterString() const;
- char* WinGetDefaultExt() const;
- HWND WinGetOwnerWindow() const;
- #endif
-
- private:
- friend class FW_CChooseFile;
- FW_SOpenFileParameters fRep;
- };
-
-
-
- //========================================================================================
- // CLASS FW_CSaveFileParameters - parameters for StandardPutFile (Mac) and GetSaveFileName (Windows)
- //========================================================================================
-
- class FW_CSaveFileParameters
- {
- public:
- FW_DECLARE_AUTO(FW_CSaveFileParameters)
-
- FW_CSaveFileParameters();
- ~ FW_CSaveFileParameters();
-
- #ifdef FW_BUILD_MAC
- public:
- FW_CSaveFileParameters(const FW_CString& savePrompt,
- const FW_CString& defaultName);
-
- void MacGetSavePrompt(FW_CString& savePrompt) const;
- void MacGetDefaultName(FW_CString& defaultName) const;
- #endif
-
- #ifdef FW_BUILD_WIN
- public:
- FW_CSaveFileParameters(const FW_CString& filterString,
- const FW_CString& defaultExt,
- const FW_CString& defaultName,
- HWND ownerWindow = NULL);
-
- void Set(const FW_CString& filterString,
- const FW_CString& defaultExt,
- const FW_CString& defaultName);
-
- char* WinGetFilterString() const;
- char* WinGetDefaultExt() const;
- char* WinGetDefaultName() const;
- HWND WinGetOwnerWindow() const;
- #endif
-
- private:
- friend class FW_CChooseFile;
- FW_SSaveFileParameters fRep;
- };
-
- //========================================================================================
- // CLASS FW_CChooseFile - choose a file to open or save
- //========================================================================================
-
- class FW_CChooseFile
- {
- public:
- static FW_OFileSpecification* ChooseFileToOpen(const FW_COpenFileParameters& openFileParam)
- {
- return FW_ChooseFileToOpen((FW_SOpenFileParameters*)&openFileParam.fRep);
- }
-
- static FW_OFileSpecification* ChooseFileToSave(const FW_CSaveFileParameters& saveFileParam)
- {
- return FW_ChooseFileToSave((FW_SSaveFileParameters*)&saveFileParam.fRep);
- }
-
- private:
- FW_CChooseFile();
- };
-
- //========================================================================================
- // CLASS FW_COpenFileParameters inlines
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- //----------------------------------------------------------------------------------------
- // FW_COpenFileParameters::Set
- //----------------------------------------------------------------------------------------
-
- inline void FW_COpenFileParameters::Set(short numTypes,
- OSType* fileTypeArray,
- FileFilterProcPtr fileFilterProc)
- {
- ::FW_FailOnError(FW_OpenFileParameters_MacSet(&fRep, numTypes, fileTypeArray, fileFilterProc));
- }
- #endif
-
- #ifdef FW_BUILD_MAC
- //----------------------------------------------------------------------------------------
- // FW_COpenFileParameters::MacCountTypes
- //----------------------------------------------------------------------------------------
- inline short FW_COpenFileParameters::MacCountTypes() const
- {
- return FW_OpenFileParameters_MacCountTypes((FW_SOpenFileParameters*)&fRep);
- }
- #endif
-
- #ifdef FW_BUILD_MAC
- //----------------------------------------------------------------------------------------
- // FW_COpenFileParameters::MacGetFilterProc
- //----------------------------------------------------------------------------------------
- inline FileFilterProcPtr FW_COpenFileParameters::MacGetFilterProc() const
- {
- return FW_OpenFileParameters_MacGetFilterProc((FW_SOpenFileParameters*)&fRep);
- }
- #endif
-
- #ifdef FW_BUILD_MAC
- //----------------------------------------------------------------------------------------
- // FW_COpenFileParameters::MacGetTypes
- //----------------------------------------------------------------------------------------
- inline OSType* FW_COpenFileParameters::MacGetTypes() const
- {
- return FW_OpenFileParameters_MacGetTypes((FW_SOpenFileParameters*)&fRep);
- }
- #endif
-
- #ifdef FW_BUILD_WIN
- //----------------------------------------------------------------------------------------
- // FW_COpenFileParameters::Set
- //----------------------------------------------------------------------------------------
-
- inline void FW_COpenFileParameters::Set(const FW_CString& filterString,
- const FW_CString& defaultExt)
- {
- ::FW_FailOnError(FW_OpenFileParameters_WinSet(&fRep, filterString, defaultExt));
- }
- #endif
-
- #ifdef FW_BUILD_WIN
- //----------------------------------------------------------------------------------------
- // FW_COpenFileParameters::WinGetFilterString
- //----------------------------------------------------------------------------------------
- inline char* FW_COpenFileParameters::WinGetFilterString() const
- {
- return FW_OpenFileParameters_WinGetFilterString((FW_SOpenFileParameters*)&fRep);
- }
- #endif
-
- #ifdef FW_BUILD_WIN
- //----------------------------------------------------------------------------------------
- // FW_COpenFileParameters::WinGetDefaultExt
- //----------------------------------------------------------------------------------------
- inline char* FW_COpenFileParameters::WinGetDefaultExt() const
- {
- return FW_OpenFileParameters_WinGetDefaultExt((FW_SOpenFileParameters*)&fRep);
- }
- #endif
-
- #ifdef FW_BUILD_WIN
- //----------------------------------------------------------------------------------------
- // FW_COpenFileParameters::WinGetOwnerWindow
- //----------------------------------------------------------------------------------------
- inline HWND FW_COpenFileParameters::WinGetOwnerWindow() const
- {
- return FW_OpenFileParameters_WinGetOwnerWindow((FW_SOpenFileParameters*)&fRep);
- }
- #endif
-
- //========================================================================================
- // CLASS FW_CSaveFileParameters inlines
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- //----------------------------------------------------------------------------------------
- // FW_CSaveFileParameters::MacGetSavePrompt
- //----------------------------------------------------------------------------------------
- inline void FW_CSaveFileParameters::MacGetSavePrompt(FW_CString& savePrompt) const
- {
- savePrompt = FW_SaveFileParameters_MacGetSavePrompt((FW_SSaveFileParameters*)&fRep);
- }
- #endif
-
- #ifdef FW_BUILD_MAC
- //----------------------------------------------------------------------------------------
- // FW_CSaveFileParameters::MacGetDefaultName
- //----------------------------------------------------------------------------------------
- inline void FW_CSaveFileParameters::MacGetDefaultName(FW_CString& defaultName) const
- {
- defaultName = FW_SaveFileParameters_MacGetDefaultName((FW_SSaveFileParameters*)&fRep);
- }
- #endif
-
- #ifdef FW_BUILD_WIN
- //----------------------------------------------------------------------------------------
- // FW_CSaveFileParameters::Set
- //----------------------------------------------------------------------------------------
- inline void FW_CSaveFileParameters::Set(const FW_CString& filterString,
- const FW_CString& defaultExt,
- const FW_CString& defaultName)
- {
- ::FW_FailOnError(FW_SaveFileParameters_WinSet(&fRep, filterString, defaultExt, defaultName));
- }
- #endif
-
- #ifdef FW_BUILD_WIN
- //----------------------------------------------------------------------------------------
- // FW_CSaveFileParameters::WinGetFilterString
- //----------------------------------------------------------------------------------------
- inline char* FW_CSaveFileParameters::WinGetFilterString() const
- {
- return FW_SaveFileParameters_WinGetFilterString((FW_SSaveFileParameters*)&fRep);
- }
- #endif
-
- #ifdef FW_BUILD_WIN
- //----------------------------------------------------------------------------------------
- // FW_CSaveFileParameters::WinGetDefaultExt
- //----------------------------------------------------------------------------------------
- inline char* FW_CSaveFileParameters::WinGetDefaultExt() const
- {
- return FW_SaveFileParameters_WinGetDefaultExt((FW_SSaveFileParameters*)&fRep);
- }
- #endif
-
- #ifdef FW_BUILD_WIN
- //----------------------------------------------------------------------------------------
- // FW_CSaveFileParameters::WinGetDefaultName
- //----------------------------------------------------------------------------------------
- inline char* FW_CSaveFileParameters::WinGetDefaultName() const
- {
- return FW_SaveFileParameters_WinGetDefaultName((FW_SSaveFileParameters*)&fRep);
- }
- #endif
-
- #ifdef FW_BUILD_WIN
- //----------------------------------------------------------------------------------------
- // FW_CSaveFileParameters::WinGetOwnerWindow
- //----------------------------------------------------------------------------------------
- inline HWND FW_CSaveFileParameters::WinGetOwnerWindow() const
- {
- return FW_SaveFileParameters_WinGetOwnerWindow((FW_SSaveFileParameters*)&fRep);
- }
- #endif
-
- #endif
-